/*
day103
2019.12.9
*/ 
#include<vector>
#include<iostream>
using namespace std;


class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
    	
    	if(nums.size()==0) return 0;
    	
        int tem=nums[0];
        int head=1,tail=1;
        
        while(tail<nums.size())
        {
        	while(nums[tail]==tem && tail<nums.size()) tail++;
        	if(nums[tail]!=tem)
        	{
        		nums[head]=nums[tail];
	        	tem=nums[head];
	        	head++;
	        	tail++;
			}
		}
		
        return head;
    }
};

int main()
{
	Solution s;
	
	vector<int> vec={1,1};
	
	int size=s.removeDuplicates(vec);

	return 0;
}
